<link rel="stylesheet" href="http://cdn.admui.com/demo/pjax/1.2.0/css/examples/components/advanced/scrollbar.css" id="siteStyle">
<script src="/static/public/vendor/bootstrap-multiselect/bootstrap-multiselect.js"></script>
<link rel="stylesheet" href="/static/public/vendor/bootstrap-multiselect/bootstrap-multiselect.css">
<script type="text/javascript" src="/static/js/echarts/echarts.min.js"></script>
<script type="text/javascript" src="/static/js/echarts/china.js"></script>
<script type="text/javascript" src="/static/js/echarts/theme/macarons.js"></script>
<title>目前成本</title>
<div class="page animation-fade">
    <div class="page-header page-header-bordered" style="position: relative;z-index:5;">
        <h1 class="page-title">成本数据</h1>
        <div class="page-header-actions">
            <select onchange="select()" name="prjId" id="prjId" data-plugin="selectpicker" multiple data-selected-text-format="count > 3" class>
          <!--      #foreach( $prj in $prjList ) <option value="${prj.id}">${prj.depotName}</option> #end -->
            </select>
            <button type="button" class="btn btn-icon btn-info collapsed" data-toggle="collapse"
                    data-target="#collapseFilter" aria-expanded="false" aria-controls="collapseFilter">
                <i class="icon fa-filter"></i>
            </button>
        </div>
    </div>

    <div class="page-content">
        <div class="collapse" id="collapseFilter" aria-expanded="false">
            <div class="panel">
                <div class="panel-body">
                    <form class="form-horizontal" id="form">
                        <div class="form-group">
                            <div class="col-sm-3">
                                <label class="col-sm-4 control-label">处理时长</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" id="dealTime" name="dealTime" >
                                </div>
                            </div>
                            <div class="col-sm-3">
                                <label class="col-sm-4 control-label">参数1</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="volume" value="1">
                                </div>
                            </div>
                            <div class="col-sm-3">
                                <label class="col-sm-4 control-label">参数2</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="load" value="100">
                                </div>
                            </div>
                            <a class="btn btn-success" onclick="reloadData()"><i class="icon fa-refresh"></i> 刷新
                            </a>
                            <div class="3">
                                <label class="col-sm-4 control-label">

                                </label>
                                <div class="col-sm-8">
                                </div>
                            </div>

                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="row">
            <div class=" col-md-6" >
                <div class="panel panel-bordered">
                    <div class="panel-heading">
                        <h3 class="panel-title" style="line-height: 0.6;">一级配送中心点</h3>
                        <div class="panel-actions">

                        </div>
                    </div>
                    <div class="panel-body padding-3 height-350" style="width:100%">
                       #parse("/lpp/network/supply/costing/map1.html")
                    </div>
                </div>
            </div>
            <div class=" col-md-6" >
                <div class="panel panel-bordered">
                    <div class="panel-heading">
                        <h3 class="panel-title" style="line-height: 0.6;">二级配送中心点</h3>
                        <div class="panel-actions">

                        </div>
                    </div>
                    <div class="panel-body padding-3 height-350" style="width:100%">
                        #parse("/lpp/network/supply/costing/map3.html")
                    </div>
                </div>
            </div>
            <div class=" col-md-12 col-xs-8" >
                <div class="panel panel-bordered">
                    <div class="panel-heading">
                        <h3 class="panel-title" style="line-height: 0.6;">一级到二级的配送路线</h3>
                        <div class="panel-actions">

                        </div>
                    </div>
                    <div class="panel-body padding-3 height-450" style="width:100%">
                      #parse("/lpp/network/supply/costing/map2.html")
                    </div>
                </div>
            </div>
            <div class=" col-ms-12 col-xs-12 col-md-2 " style="top: 31px;">
                <div class="panel panel-bordered">
                    <div class="panel-heading">
                        <h3 class="panel-title" style="line-height: 0.6;">可靠性参数值</h3>
                        <div class="panel-actions">

                        </div>
                        <div class="panel-body padding-3 height-450" style="width:100%;height: 400px;">
                            <table class="table table-bordered table-hover">
                                <tbody>
                                <tr>
                                    <td class="text-nowrap" style="font-size: 12px;">
                                        一级中心
                                    </td>
                                    <td style="font-size: 12px;" id="list1" name="list1">
                                         0个
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-nowrap" style="font-size: 12px;">
                                        二级中心
                                    </td>
                                    <td style="font-size: 12px;" id="list2">
                                          0个
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-nowrap" style="font-size: 12px;">
                                        库存水平
                                    </td>
                                    <td style="font-size: 12px;" id="list3">
                                          0
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-nowrap" style="font-size: 12px;">
                                        运输距离
                                    </td>
                                    <td style="font-size: 12px;" id="list4">
                                        0米
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-nowrap" style="font-size: 12px;">
                                        再订货点
                                    </td>
                                    <td style="font-size: 12px;" id="list5">
                                       0
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-nowrap" style="font-size: 12px;">
                                        运输费用
                                    </td>
                                    <td style="font-size: 12px;" id="list6">
                                       0元
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-nowrap" style="font-size: 12px;">
                                        周转库存
                                    </td>
                                    <td style="font-size: 12px;" id="list7">
                                          0
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class=" col-md-10 col-ms-12 col-xs-12">
                <div class="example-wrap">
                    <div class="example" style="height: 427px;">
                        <div data-plugin="slimScroll" style="overflow: hidden; width: auto; height: 400px;">
                            <div class=" col-md-4">
                                <div class="panel panel-bordered">
                                    <div class="panel-heading">
                                        <h3 class="panel-title" style="line-height: 0.6;">一级配送中心安全库存水平(SS)</h3>
                                        <div class="panel-actions">

                                        </div>
                                    </div>
                                    <div  class="panel-body padding-3 height-300" style="width:100%">
                                        #parse("/lpp/network/supply/costing/bar1.html")
                                    </div>
                                </div>
                            </div>
                            <div class=" col-md-4">
                                <div class="panel panel-bordered">
                                    <div class="panel-heading">
                                        <h3 class="panel-title" style="line-height: 0.6;">到各二级配送中心运输总距离</h3>
                                        <div class="panel-actions">

                                        </div>
                                    </div>
                                    <div class="panel-body padding-3 height-300" style="width:100%">
                                        <div  style="height: 100%">
                                            #parse("/lpp/network/supply/costing/bar2.html")
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class=" col-md-4">
                                <div class="panel panel-bordered">
                                    <div class="panel-heading">
                                        <h3 class="panel-title" style="line-height: 0.6;">路径总距离（各一级配送中心）</h3>
                                        <div class="panel-actions">

                                        </div>
                                    </div>
                                    <div class="panel-body padding-3 height-300" style="width:100%">
                                        <div style="height: 100%">
                                            #parse("/lpp/network/supply/costing/bar3.html")
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class=" col-md-4">
                                <div class="panel panel-bordered">
                                    <div class="panel-heading">
                                        <h3 class="panel-title" style="line-height: 0.6;">一级配送中心再订货点</h3>
                                        <div class="panel-actions">

                                        </div>
                                    </div>
                                    <div class="panel-body padding-3 height-300" style="width:100%">
                                        <div  style="height: 100%">
                                            #parse("/lpp/network/supply/costing/bar4.html")
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class=" col-md-4">
                                <div class="panel panel-bordered">
                                    <div class="panel-heading">
                                        <h3 class="panel-title" style="line-height: 0.6;">到各二级配送中心运输费用</h3>
                                        <div class="panel-actions">

                                        </div>
                                    </div>
                                    <div class="panel-body padding-3 height-300" style="width:100%">
                                        <div  style="height: 100%">
                                            #parse("/lpp/network/supply/costing/bar5.html")
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class=" col-md-4">
                                <div class="panel panel-bordered">
                                    <div class="panel-heading">
                                        <h3 class="panel-title" style="line-height: 0.6;">运输成本（各一级配送中心）</h3>
                                        <div class="panel-actions">

                                        </div>
                                    </div>
                                    <div class="panel-body padding-3 height-300" style="width:100%">
                                        <div  style="height: 100%">
                                            #parse("/lpp/network/supply/costing/bar6.html")
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class=" col-md-4">
                                <div class="panel panel-bordered">
                                    <div class="panel-heading">
                                        <h3 class="panel-title" style="line-height: 0.6;">订货周期内的周转库存</h3>
                                        <div class="panel-actions">

                                        </div>
                                    </div>
                                    <div class="panel-body padding-3 height-300" style="width:100%">
                                        <div  style="height: 100%">
                                            #parse("/lpp/network/supply/costing/bar7.html")
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class=" col-md-4">
                                <div class="panel panel-bordered">
                                    <div class="panel-heading">
                                        <h3 class="panel-title" style="line-height: 0.6;">经济订货批量（EOQ）</h3>
                                        <div class="panel-actions">

                                        </div>
                                    </div>
                                    <div class="panel-body padding-3 height-300" style="width:100%">
                                        <div  style="height: 100%">
                                            #parse("/lpp/network/supply/costing/bar8.html")
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class=" col-md-4">
                                <div class="panel panel-bordered">
                                    <div class="panel-heading">
                                        <h3 class="panel-title" style="line-height: 0.6;">一级配送中心1个月租赁费用</h3>
                                        <div class="panel-actions">

                                        </div>
                                    </div>
                                    <div class="panel-body padding-3 height-300" style="width:100%">
                                        <div  style="height: 100%">
                                            #parse("/lpp/network/supply/costing/bar9.html")
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--<div class=" col-md-4">-->
                                <!--<div class="panel panel-bordered">-->
                                    <!--<div class="panel-heading">-->
                                        <!--<h3 class="panel-title" style="line-height: 0.6;">平均库存（周转库存+安全库存）</h3>-->
                                        <!--<div class="panel-actions">-->

                                        <!--</div>-->
                                    <!--</div>-->
                                    <!--<div class="panel-body padding-3 height-300" style="width:100%">-->
                                        <!--<div  style="height: 100%">-->
                                            <!--#parse("/lpp/network/supply/costing/bar10.html")-->
                                        <!--</div>-->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</div>-->

                            <!--<div class=" col-md-4">-->
                                <!--<div class="panel panel-bordered">-->
                                    <!--<div class="panel-heading">-->
                                        <!--<h3 class="panel-title" style="line-height: 0.6;">订单完成周期</h3>-->
                                        <!--<div class="panel-actions">-->

                                        <!--</div>-->
                                    <!--</div>-->
                                    <!--<div class="panel-body padding-3 height-300" style="width:100%">-->
                                        <!--<div  style="height: 100%">-->
                                            <!--#parse("/lpp/network/supply/costing/bar11.html")-->
                                        <!--</div>-->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</div>-->

                            <!--<div class=" col-md-4">-->
                                <!--<div class="panel panel-bordered">-->
                                    <!--<div class="panel-heading">-->
                                        <!--<h3 class="panel-title" style="line-height: 0.6;">展示结果</h3>-->
                                        <!--<div class="panel-actions">-->
                                            <!--<button type="button" class="btn btn-raised btn-primary btn-block" id='return-button12' value=''>返回</button>-->
                                        <!--</div>-->
                                    <!--</div>-->
                                    <!--<div class="panel-body padding-3 height-300" style="width:100%">-->
                                        <!--<div  style="height: 100%">-->
                                            <!--#parse("/lpp/network/supply/costing/bar12.html")-->
                                        <!--</div>-->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</div>-->

                            <div style="display:none;" id="trueShow"></div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<script>
    function select() {
        //loadMaps();
        var selected=$("select[name='prjId']").val();
        // var selected=$("#prjId option:selected").text();
        $.ajax({
            url: "#springUrl('/network/supply/costing/getAllData')",
            data: {"time": $("#dealTime").val(),"selected":selected.toString(),"nowold":"1"},
            type: "post",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    loadbar1(d);
                    loadbar2(d);
                    loadbar3(d);
                    loadbar4(d);
                    loadbar5(d);
                    loadbar6(d);
                    loadbar7(d);
                    loadbar8(d);
                    loadbar9(d);
                    lists(d);
                    var type="1";
                   // loadMap(type);
                }else{
                    toastr.error(d.message);
                }
            },
        });

    }
    function lists(d){
        //list1.innerText = "td的值";

        document.getElementById("list1").innerText=d.data.list1+"个";
        document.getElementById("list2").innerText=d.data.list2+"个";
        document.getElementById("list3").innerText=d.data.list3;
        document.getElementById("list4").innerText=d.data.list4+"米";
        document.getElementById("list5").innerText=d.data.list5;
        document.getElementById("list6").innerText=d.data.list6+"元";
        document.getElementById("list7").innerText=d.data.list7;
    }


    $(function () {
       // setTimeout("window.clearInterval(t1)",4000);
        build();
        //var t1=window.setInterval("build()",1000);

       // var trueShow=$("#trueShow").val();
        // if(trueShow==1){
        //    window.clearInterval(t1);
        //}
        //window.onunload(clearInterval(t1));

    });
    function buildTime() {

    }
    function selectRadio(){
        $.ajax({
            "type": "post",
            "data": {"nowold":"1"},
            "url": "/network/supply/costing/getSelect",
            "success": function(text){
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    $("#prjId").empty();
                    for(var i=0;i<d.data.length;i++){
                       // alert(d.data[i]);
                        var primarySales=d.data[i];
                        var options="<option  value='"+ primarySales +"'  >"+primarySales+"</option>";
                        $("#prjId").append(options);
                    }
                }
            }
        });
    }
    function reloadData() {
        document.getElementById("loading").style.display="block";
        build();
    }
    function build(){
        selectRadio();
        $.ajax({
            url: "#springUrl('/network/supply/costing/getAllData')",
            data: {"time": $("#dealTime").val(),"selected":"","nowold":"1"},
            type: "POST",
            //async: false,
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data && d.data.arr5) {
                    loadbar1(d);
                    loadbar2(d);
                    loadbar3(d);
                    loadbar4(d);
                    loadbar5(d);
                    loadbar6(d);
                    loadbar7(d);
                    loadbar8(d);
                    loadbar9(d);
                    lists(d);
                    // loadbar10(d);
                   // loadbar11(d);
                   // loadbar12(d);
                    var type="1";
                    oldMaps1(type);
                    oldMaps2(type);
                    var type1="2";
                    oldMaps3(type,type1);
                    $("#trueShow").val(1);
                }else if(d.success && d.data){
                    toastr.success('算法正在处理，请等5分钟以后，刷新游览器');
                }else{
                    var d = JSON.parse(text);
                    toastr.error(d.message);
                    var div1="<div type='text' style='padding-top:18%' class=' text-center '>"+d.message+"</div>";
                    document.getElementById('map1').innerHTML=div1;
                }
            },
            error:function (text) {
                alert(2);
                var d = JSON.parse(text);
            }
        });
    }
</script>

